<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/jsp/inc/header.jsp" %>
<c:set var="title" value="车库"/>
<c:set var="rootpath" value="${CONTEXT_PATH}/admin/product/car"/>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="${STATIC_HOST}/css/ligerui.css" rel="stylesheet" type="text/css"/>
    <link href="${STATIC_HOST}/css/common.css" rel="stylesheet" type="text/css" />
    <script src="${STATIC_HOST}/js/common.js" type="text/javascript"></script>
    <script src="${STATIC_HOST}/js/LG.js" type="text/javascript"></script>
    <title>${title}管理</title>
</head>
<body class="listbody">

	<!-- 搜索开始 -->
	<div id="mainsearch">
		<div class="searchbox">
		<form action="${rootpath}/list.do" method="post" name="searchForm" id="searchForm">
		<ul>
		   <li style="float:left;"><label for="eqId">id</label>：</li>
			   <li class="li_search_right" style="padding-right:20px;">
			<input type="text" name="eqId" id="eqId" size="10" ltype='text' ligerui='{"width":100}'  value="${eqId}"/>
		  </li> 
		   <li style="float:left;"><label for="likeName">汽车名称</label>：</li>
			   <li class="li_search_right" style="padding-right:20px;">
			<input type="text" name="likeName" id="likeName" size="10" ltype='text' ligerui='{"width":100}'  value="${likeName}"/>
		  </li>
			<li style="float:left;"><label for="eqStatus">状态</label>：</li>
			<li class="li_search_right" style="padding-right:20px;">
				<select name="eqStatus" id="eqStatus" ltype="select" size="1" ligerui='{"width":100}'>
					<option value=""  <c:if test="${eqStatus==''}">selected</c:if> >-全部-</option>
					<option value="1"  <c:if test="${eqStatus==1}">selected</c:if> >有效</option>
					<option value="0"  <c:if test="${eqStatus==0}">selected</c:if> >无效</option>
				</select>
			</li>
		  <div id="searchbutton" class="button button2 buttonnoicon">
			<div class="button-l"></div>
			<div class="button-r"></div>
			<span>搜索</span>
		  </div>
		</ul>
	  </form>
	  </div>
	</div>
	<!-- 搜索结束 -->   
	
	<div class="div_newline"></div>
	
	<!-- 列表开始 -->
	<div id="maingrid"></div> 
	<!-- 列表结束 -->


<script type="text/javascript">
	var statusMap   =   ${jsonali:toJSONString(statusMap)};
	var cateTypeMap	=	${jsonali:toJSONString(cateTypeMap)};

	//列表
	var grid = $("#maingrid").ligerGrid({
		
      columns: [
        { display:"id", name:"id", align: 'left', width: 80, type: 'int' },
	    { display:"汽车名称", name:"name", align: 'left', width: 250 },
	    { display:"关键词", name:"keyword", align: 'left', width: 100, hide:true },
	    { display:"序号", name:"sortNum", align: 'left', width: 100 ,type: 'int'},
		{ display:"状态", name:"status", align: 'left', width: 80, type: 'int', render: function(row){
			  return "<span class='status" + row.status+"'>"+statusMap[row.status]+"</span>";
		  }
		},
	    { display:"修改时间", name:"modifyTime", align: 'left', width: 130 ,type: 'date' },
      ],
      parms: [ {name:'_ajax', value:1}
          <c:if test="${not empty eqId}">, { name:'eqId',value:'${eqId}'}</c:if>
          <c:if test="${not empty eqName}">, { name:'eqName',value:'${eqName}'}</c:if>
          <c:if test="${not empty eqNameShort}">, { name:'eqNameShort',value:'${eqNameShort}'}</c:if>
          <c:if test="${not empty eqKeyword}">, { name:'eqKeyword',value:'${eqKeyword}'}</c:if>
          <c:if test="${not empty eqFirstPicUrl}">, { name:'eqFirstPicUrl',value:'${eqFirstPicUrl}'}</c:if>
          <c:if test="${not empty eqDetails}">, { name:'eqDetails',value:'${eqDetails}'}</c:if>
          <c:if test="${not empty eqSortNum}">, { name:'eqSortNum',value:'${eqSortNum}'}</c:if>
          <c:if test="${not empty eqStatus}">, { name:'eqStatus',value:'${eqStatus}'}</c:if>
          <c:if test="${not empty eqClickNum}">, { name:'eqClickNum',value:'${eqClickNum}'}</c:if>
          <c:if test="${not empty eqShareNum}">, { name:'eqShareNum',value:'${eqShareNum}'}</c:if>
          <c:if test="${not empty eqGoodNum}">, { name:'eqGoodNum',value:'${eqGoodNum}'}</c:if>
          <c:if test="${not empty eqBadNum}">, { name:'eqBadNum',value:'${eqBadNum}'}</c:if>
          <c:if test="${not empty eqCreateUserId}">, { name:'eqCreateUserId',value:'${eqCreateUserId}'}</c:if>
          <c:if test="${not empty eqCreateTime}">, { name:'eqCreateTime',value:'${eqCreateTime}'}</c:if>
          <c:if test="${not empty eqModifyUserId}">, { name:'eqModifyUserId',value:'${eqModifyUserId}'}</c:if>
          <c:if test="${not empty eqModifyTime}">, { name:'eqModifyTime',value:'${eqModifyTime}'}</c:if>
         ] ,
	    pageSize: ${pageSize}, pageSizeOptions:[5,10,20,40,60,80,100],
	    pageParmName:'pageNo', pagesizeParmName:'pageSize', sortnameParmName:'sortName',sortorderParmName:'sortOrder',
	    dataAction:'server', 
	    url: '${rootpath}/search.do',
		<c:choose><c:when test="${param.gridMultiple=='1'}">checkbox: true,</c:when>
		<c:otherwise>checkbox: false,onSelectRow: function (data, rowindex, rowobj){parent.window.f_selectDO(f_selected())},</c:otherwise></c:choose>
		frozen: false , dateFormat:'yyyy-MM-dd hh:mm',
		width: '100%', height: '85%', rowHeight:25, fixedCellHeight: true, usePager: true
	});

	function f_selected(){
		return grid.getSelectedRows();
	}

	jQuery("#searchbutton").click(function(){
	    var params = '';
        var group = {};
		var form=$("#searchForm");
        $(":input", form).not(":submit, :reset, :image,:button, [disabled]").each(function (){
            if (!this.name) return;
            if ($(this).val() == null || $(this).val() == "") return;
            var ltype = $(this).attr("ltype");
            var optionsJSON = $(this).attr("ligerui"), options;
            if (optionsJSON){
                options = JSON2.parse(optionsJSON);
            }
            //get the value type(number or date)
            var value = $(this).val();
            var name = this.name;
            //如果是下拉框，那么读取下拉框关联的隐藏控件的值(ID值,常用与外表关联)
            if (ltype == "select" && options && options.valueFieldID){
                value = $("#" + options.valueFieldID).val();
                name = options.valueFieldID;
            }
            group[name]=value;
			params += ("&"+name+"="+encodeURIComponent(value));
        });
	    grid.set('parms', group);
        grid.loadData();
        $("#queryParam").val( params.substring(1) );
	});
	
	$("#searchForm").ligerForm();
	
</script>

</body>
</html>